package com.yazi.mxz.common.db.dao.impl;



import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.yazi.mxz.common.db.dao.EmailDao;
import com.yazi.mxz.common.entity.beans.Email;
import com.myframework.smhj.hibernate.Searching;
import com.myframework.smhj.hibernate.Page;
import com.myframework.smhj.hibernate.dao.BasicDao;

@Repository("emailDao")
public class EmailDaoImpl extends BasicDao<Email> implements EmailDao {


	public EmailDaoImpl() {
		super(Email.class);
		
	}

	@Override
	public Page<Email> listByGtAddtime(Email email, Searching search) {
		Long addTime = email.getAddTime();
		email.setAddTime(null);
		Criteria c = getExample(email, search.getSearchWord());
		// 大于某个时间 
		if (null != addTime) {
			c.add(Restrictions.gt("addTime", addTime));
		}
		return list(c, search);
	}

}
